<?php

namespace App\Repositories\System;

use App\Facade\AppContext;
use App\Models\BaseModel;
use App\Models\Ca\Docker;
use App\Models\System\Hospital;
use App\Repositories\BaseRepository;
use App\Utils\Output;
use App\Utils\QueryHelper;

class HospitalRepository extends BaseRepository
{
    function adminPager($params): Output
    {
        extract($params);
        $query = Hospital::query();
        if (!empty($keyword)) {
            QueryHelper::like($query, 'name', $keyword);
        }
        $query->select(
            'id',
            'name',
            'created_at',
            'updated_at'
        );
        return $this->queryToPager($query, $params, 'id');
    }

    function lis()
    {
        $query = Hospital::query();
        $query->select('id', 'name');
        return $query->get();
    }

    function getModel(): BaseModel
    {
        return new Hospital();
    }
}